package com.lvmama.pangolin.mt.service.impl;

import com.github.pagehelper.PageHelper;
import com.lvmama.pangolin.entity.mt.MTTicketProductItem;
import com.lvmama.pangolin.entity.mt.MTTicket_Commodity;
import com.lvmama.pangolin.mybatis.mapper.mt.MTTicketProductItemsMapper;
import com.lvmama.pangolin.mt.service.MTTicketProductItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class MTTicketProductItemsServiceImpl implements MTTicketProductItemsService{
	@Override
	public List<MTTicketProductItem> selectItemProdByProdId(String prodId) {
		return mtProductItemsMapper.selectItemProdByProdId(prodId);
	}

	/**  
	* @Title：TCProductItemsServiceImpl.java
	* @Author:zhoutianqi
	* @Description:
	* @Date：2017年3月6日下午4:27:26  
	*/
	@Autowired
	private MTTicketProductItemsMapper mtProductItemsMapper;
	public int insert(MTTicket_Commodity item)throws Exception{
		return mtProductItemsMapper.insert(item);
	}
	public MTTicketProductItem selectById(String id)throws Exception{
		return mtProductItemsMapper.selectById(id);
	}
	public int update(MTTicket_Commodity item)throws Exception{
		return mtProductItemsMapper.update(item);
	}
	@Override
	public List<MTTicketProductItem> selectByLimitNum(int page, int pageSize) {
		PageHelper.startPage(page, pageSize,"product_id asc"); // 核心分页代码
		List<MTTicketProductItem> list = mtProductItemsMapper.selectByLimitNum();
		return list;
	}
	@Override
	public int updateByItem(MTTicketProductItem item) {
		return mtProductItemsMapper.updateByItem(item);
	}
}
